﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GenericLibrary.ExtensionMethods {

    public static class TypeExtension {

        public static T GetCustomAttribute<T>(this Type type, bool inherit = false) where T : Attribute {
            object[] customAttributes = type.GetCustomAttributes(typeof(T), inherit);
            if(customAttributes.Length > 0) {
                return customAttributes[0] as T;
            }
            return null;
        }
    }
}
